package agents;

import java.util.Iterator;
import java.util.Vector;

import minimax.MoveNode_A;
import minimax.MoveNode_B;
import minimax.MoveNode_C;
import env.City;
import env.Move;
import env.World;

public class AdverseryAgent extends AgentImpl implements Agent {
	public AdverseryAgent foe;
	World world;
	public int score;
	
	public AdverseryAgent(AdverseryAgent foe, World world) {
		super();
		R=main.Main.goalScore;
		goals = new Vector<>();
		score=0;
		this.foe = foe;
		this.world = world;
		if(foe!=null && foe.foe==null)
			foe.foe=this;
	}

	

	@Override
	public Move calcMove() {
//		MoveNode_A movenode = new MoveNode_A(world, null, null, this, foe);
//		MoveNode_B movenode = new MoveNode_B(world, null, null, this, foe);
		MoveNode_C movenode = new MoveNode_C(world, null, null, this, foe);
		return movenode.Minimax_decide();
//		return movenode.moveToHere;
	}

	@Override
	public boolean isDone() {
		
		return !world.chemsInWorld();
	}
	public boolean isDone(World copy) {
		
		return !copy.chemsInWorld();
	}
	@Override
	public int getExpands() {
		
		return 0;
	}

	@Override
	public boolean CityInGoals(City c) {
		Iterator<City> it = goals.iterator();
		while(it.hasNext())
		{
			if(it.next().nameEquals(c))
				return true;
		}
		return false;
	}

}
